/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.custom.events.engine;

import java.util.List;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.skills.AbnormalEffect;

/**
 * @author Anarchy
 *
 */
public class EventTeam
{
	private List<L2PcInstance> _players;
	private String _name;
	private int _points;
	
	public EventTeam(List<L2PcInstance> players, String name, int points)
	{
		_players = players;
		_name = name;
		_points = points;
		
		for (L2PcInstance p : _players)
		{
			p.setEventTeam(this);
		}
	}
	
	public void teleportTeam(int x, int y, int z, boolean sendMessage)
	{
		for (L2PcInstance p : _players)
		{
			p.teleToLocation(x, y, z, 1);
			if (sendMessage)
				p.sendMessage("You have been teleported.");
		}
	}
	
	public void paralize(boolean val)
	{
		if (val)
		{
			for (L2PcInstance p : _players)
			{
				p.startAbnormalEffect(AbnormalEffect.ROOT);
				p.setIsParalyzed(true);
			}
		}
		else
		{
			for (L2PcInstance p : _players)
			{
				p.stopAbnormalEffect(AbnormalEffect.ROOT);
				p.setIsParalyzed(false);
			}
		}
	}
	
	public void rewardTeam(int itemId, int count)
	{
		for (L2PcInstance p : _players)
		{
			p.addItem("Event Reward", itemId, count, null, true);
		}
	}
	
	public void addPoints(int val)
	{
		_points += val;
	}
	
	public void removePoints(int val)
	{
		_points -= val;
	}
	
	public int getPoints()
	{
		return _points;
	}
	
	public String getName()
	{
		return _name;
	}
	
	public boolean containsPlayer(L2PcInstance p)
	{
		return _players.contains(p);
	}
}
